<?php
namespace app\v1\controller;
use think\Db;
use think\Controller;
use think\cache\driver\Redis;
use qcloud\cos\Qcloud;
use OSS\OssClient;
use app\v1\controller\Authorization;

/**
 * Class Index
 * @package app\v1\controller
 * 首页模块控制器
 */
class Index extends Authorization
{

    //获取首页信息
    public function getIndex(){
        //首页banner,之前是写死的
        $bannerList=array(1=>config('web_url').'/1.png',2=>config('web_url').'/2.png');
        $user=model('v1/User');
        $integral=model('v1/Integral');
        $userInfo=getUserInfo();
        $childInfo=$user->getCommonInfo($userInfo['childId'],$userInfo['orgId'],$userInfo['schoolId']);
        $integralInfo=$integral->getIntegralInfo($userInfo['childId']);
        $data=array('bannerList'=>$bannerList,'childInfo'=>$childInfo,'integralInfo'=>$integralInfo);
        renderData(0,'ok',$data);
    }
   //获取食谱列表
    public function getCookList(){
        $cook=model('Cook');
        $cook->getCookList();
    }

    //基因检测
    public function geneDetection(){
        $user=model('v1/User');
        $phone=$user->getUserphone();
        $timestamp=msectime();
        $code=md5(md5('htg'.'aikang'.$phone.$timestamp).'2018');
        $data=array('phone'=>$phone,'timestamp'=>$timestamp,'code'=>$code);
        renderData(0,'ok',$data);

    }


}
